<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        var sum = 0;
        let arr = [78, 82, 89, 86, 72, 54, 65, 83, 78, 91];
        for (var i = 0; i < arr.length; i++) {
            sum += arr[i]
        }

        let newArr = arr.filter(function (value, index) {
            //列如返回数组大于8的元素
            avg = sum / (arr.length)
            if (value > avg) {
                return value
            }
            return
        })
        console.log(avg);
        console.log(newArr);
    </script>
</body>

</html>